Skip to content

fix(cli): prisma deploy records a failed build of the Service on the run's build - #440

Draft
kristof-siket wants to merge 1 commit into
mainfrom
fix/report-service-build-failure
Draft

kristof-siket wants to merge 1 commit into
mainfrom
fix/report-service-build-failure

Conversation

@kristof-siket

Copy link
Copy Markdown
Contributor

Why

A Service deploy (prisma deploy in a repository without a composer section) builds the Service first: install, build, find the start. Composer's deploy runs after that, and Composer is what reports the deploy on the build that the deploy workflow opened (PRISMA_BUILD_ID).

So a failed install or build reports nothing. prisma/cloud-deploy-action then writes its own text on the build: "npx --yes prisma@latest deploy … exited with status 2". The platform cannot tell a failed install from a failed build, a missing start command, or a server that imports files from outside the Service folder.

A production run on 2026-12-05 shows this. Between the action's "running" update and its "failed" update, 41 seconds later, the CLI sent no request to the Management API.

What changes

When the build of the Service fails and the run has a build on Prisma Cloud, the CLI sends one PATCH /v1/builds/{buildId}:

Field Value
state failed
phase build
failingStep the CLI's error code: DEPLOY.SERVICE_INSTALL_FAILED, DEPLOY.SERVICE_BUILD_FAILED, DEPLOY.SERVICE_NO_START or DEPLOY.SERVICE_FILES_OUTSIDE_FOLDER
errorMessage the error's summary, such as "Step failed: npm run build"
  • The build id is --build-id, else PRISMA_BUILD_ID. The flag wins and an empty value counts as unset, as in Composer.
  • A run without a build id sends nothing, so a deploy from a laptop behaves as before.
  • A report that fails prints a warning. The command still ends with the build's own error.
  • The command's output, error and exit code do not change.

prisma/cloud-deploy-action needs no change. It already reads the build before its own failure update and keeps a failure that the CLI reported.

Not changed

  • The output of the failed command is not sent. Only the code and the summary are.
  • A Composer deploy. Composer reports its own failures, but only from its connect step on. A failure before that step (config, load, assemble) still reports nothing. That is a separate change in prisma/composer.

Tests

packages/cli/tests/deploy.test.ts:

  • records the failure on the build that PRISMA_BUILD_ID names, with the four fields above
  • uses --build-id when both are set
  • records nothing when the run has no build
  • keeps the build's own error and warns when the API refuses the report, and when the request fails

Local runs: all @prisma/cli unit tests pass (76 files, 1534 tests), tsc --noEmit passes, and Biome passes on the changed files.

Not run locally: pnpm --filter @prisma/cli test:e2e. It needs a service token that I do not have. No test here runs the change against the real Management API.

Size

3 files, +176 −4. The test file is +122 −2 of that.

🤖 Generated with Claude Code

…e run's build

A Service deploy builds the Service first and starts Composer's deploy
after it. Composer reports the deploy on the build that the deploy
workflow opened, so a failed install or build reported nothing. The
workflow then recorded only "prisma deploy exited with status 2".

When the run has a build (--build-id, else PRISMA_BUILD_ID), the CLI now
sends the failure's code and summary to it.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Signed-off-by: Kristof Siket <siket@prisma.io>
@coderabbitai

coderabbitai Bot commented Dec 5, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@pkg-pr-new

pkg-pr-new Bot commented Dec 5, 2026

Copy link
Copy Markdown

Open in StackBlitz

npx https://pkg.pr.new/@prisma/cli@440
npx https://pkg.pr.new/@prisma/cli-engine@440

commit: 3912aa8

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant